<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" href="css/amazeui.min.css" />
		<link rel="stylesheet" href="css/admin.css" />
	</head>

	<body>
		<div class="admin-content-body">
			<div class="am-cf am-padding am-padding-bottom-0">
				<div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">新闻管理</strong><small></small></div>
			</div>

			<hr>

			<div class="am-g">
				<div class="am-u-sm-12 am-u-md-3">
					<div class="am-btn-toolbar">
						<div class="am-btn-group am-btn-group-xs">
							<a href="" class="am-btn am-btn-default"><span class="am-icon-plus"></span> 新增</a>
						</div>
					</div>
				</div>
				<div class="am-u-sm-12 am-u-md-9">
					<form action="/getUsersByPage" method="post">
						用户名: <input type="text" name="userName">
						用户角色:
						<select name="userRole">
							<option value="">请选择</option>
							<c:forEach items="${roleList}" var="role">
								<option value="${role.id}">${role.rolename}</option>
							</c:forEach>
						</select>
						<input type="submit" value="查询">
					</form>
				</div>
			</div>
			<div class="am-g">
				<div class="am-u-sm-12">
					<form class="am-form">
						<table class="am-table am-table-striped am-table-hover table-main">
							<thead>
								<tr>
									<th class="table-title">用户编码</th>
									<th class="table-title">用户名称</th>
									<th class="table-type">性别</th>
									<th class="table-author">年龄</th>
									<th class="table-author">电话</th>
									<th class="table-author">用户角色</th>
									<th class="table-set">操作</th>
								</tr>
							</thead>
							<tbody>
								<c:forEach items="${pageInfo.list}" var="user">
									<tr>
										<td>
											<a href="/getById/${user.id}">${user.usercode}</a>
										</td>
										<td>
											${user.username}
										</td>
										<td class="am-hide-sm-only">${user.gender==1?"女":"男"}</td>
										<td>${user.age}</td>
										<td>${user.phone}</td>
										<td>${user.roleName}</td>
										<td>
											<div class="am-btn-toolbar">
												<div class="am-btn-group am-btn-group-xs">
													<button class="am-btn am-btn-default am-btn-xs am-text-secondary"><span class="am-icon-pencil-square-o"></span> 编辑</button>
													<button class="am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only"><span class="am-icon-trash-o"></span> 删除</button>
												</div>
											</div>
										</td>
									</tr>
								</c:forEach>
							</tbody>
						</table>
						<div class="am-cf">
							共 ${pageInfo.total} 条记录
							<div class="am-fr">
								<ul class="am-pagination">
									<li
										<c:if test="${!pageInfo.hasPreviousPage}">
											class="am-disabled"
										</c:if>
									>
										<a href="/getUsersByPage?pageNum=${pageInfo.pageNum-1}">«</a>
									</li>

									<c:forEach begin="1" end="${pageInfo.pages}" step="1" var="i">
										<li
											<c:if test="${pageInfo.pageNum == i}">
												class="am-active"
											</c:if>
										>
											<a href="/getUsersByPage?pageNum=${i}">${i}</a>
										</li>
									</c:forEach>
									<li
										<c:if test="${!pageInfo.hasNextPage}">
											class="am-disabled"
										</c:if>
									>
										<a href="/getUsersByPage?pageNum=${pageInfo.pageNum+1}">»</a>
									</li>
								</ul>
							</div>
						</div>
						<hr>
					</form>
				</div>
			</div>
		</div>
	</body>
</html>